<?php 

	require_once( '../../../../../wp-load.php' );
	Header("Content-type: text/css");

	$standard_fonts = array(
		'Arial',
		'Tahoma',
		'Verdana',
		'Georgia',
		'FreeSans',
		'Lucida Sans Unicode',
		'Trebuchet MS'
	);

	$gen_sets = theme_get_option('general', 'gen_sets');
	$menu_gfont = ( isset($gen_sets['_menu_gfont']) ) ? $gen_sets['_menu_gfont'] : '';
	$headers_gfont = ( isset($gen_sets['_headers_gfont']) ) ? $gen_sets['_headers_gfont'] : '';
	$text_gfont = ( isset($gen_sets['_text_gfont']) ) ? $gen_sets['_text_gfont'] : '';

	$pretty_social = isset($gen_sets['_pretty_social']) ? $gen_sets['_pretty_social'] : '';

	$mainmenu_color = isset($gen_sets['_mmf_color']) ? $gen_sets['_mmf_color'] : '';
	$header_color = isset($gen_sets['_cth_color']) ? $gen_sets['_cth_color'] : '';
	$text_color = isset($gen_sets['_ct_color']) ? $gen_sets['_ct_color'] : '';

	$h1_size = isset($gen_sets['_h1_size']) ? $gen_sets['_h1_size'] : '';
	$h2_size = isset($gen_sets['_h2_size']) ? $gen_sets['_h2_size'] : '';
	$h3_size = isset($gen_sets['_h3_size']) ? $gen_sets['_h3_size'] : '';
	$h4_size = isset($gen_sets['_h4_size']) ? $gen_sets['_h4_size'] : '';
	$h5_size = isset($gen_sets['_h5_size']) ? $gen_sets['_h5_size'] : '';
	$h6_size = isset($gen_sets['_h6_size']) ? $gen_sets['_h6_size'] : '';

	$content_fsize = isset($gen_sets['_content_fsize']) ? $gen_sets['_content_fsize'] : '';
	$content_lineheight = isset($gen_sets['_content_lineheight']) ? $gen_sets['_content_lineheight'] : '';

	$import = '';
	$style = '';

	if($menu_gfont && !in_array($menu_gfont, $standard_fonts)){
		$menu_gfont = str_replace("", "+" , $menu_gfont);
		$import .= "@import url(http://fonts.googleapis.com/css?family=" . $menu_gfont . ");\n";
		$menu_gfont = str_replace("+", " " , $menu_gfont);
		$style .= "body #kids_main_nav {font-family: '". $menu_gfont ."', cursive !important;}\n";
	}

	if($headers_gfont && !in_array($headers_gfont, $standard_fonts)){
		$headers_gfont = str_replace(" ", "+" , $headers_gfont);
		$import .= "@import url(http://fonts.googleapis.com/css?family=" . $headers_gfont . ");\n";
		$headers_gfont = str_replace("+", " " , $headers_gfont);
		$style .= "h1, h2, h3, h4, h5, h6 {font-family: '". $headers_gfont ."', sans-serif !important;}\n";
	}

	if($text_gfont && !in_array($text_gfont, $standard_fonts)){
		$text_gfont = str_replace(" ", "+" , $text_gfont);
		$import .= "@import url(http://fonts.googleapis.com/css?family=" . $text_gfont . ");\n";
		$text_gfont = str_replace("+", " " , $text_gfont);
		$style .= "body {font-family: '". $text_gfont ."', Arial !important;}\n";
	}

	if($menu_gfont || $headers_gfont || $text_gfont){
		echo $import;
		echo $style;
	}

	if ($header_color){
		echo "h1, h2, h3, h4, h5, h6 {color: ". $header_color ." !important;}\n";
		echo ".entry-container a, .gallery a, .kids_top_content_middle a {color: ". $header_color ." !important;}\n";
		// echo "header_container h1 {};
	}
	if ($mainmenu_color) echo "#kids_main_nav a {color: ". $mainmenu_color ." !important;}\n";
	if ($text_color){
		echo "body {color: ". $text_color ." !important;}\n";
		echo ".header_container h1 {color: ". $text_color ." !important;}\n";
		echo ".entry-container a:hover, .gallery a:hover, .kids_top_content_middle a:hover {color: ". $text_color ." !important;}\n";
	}

	if ($h1_size){
		echo "h1 {font-size: ". $h1_size ."px !important;}\n";
		echo ".widget h3 {font-size: ". $h1_size ."px !important;}\n";
	}
	if ($h2_size) echo "h2 {font-size: ". $h2_size ."px !important;}\n";
	if ($h3_size) echo "h3 {font-size: ". $h3_size ."px !important;}\n";
	if ($h4_size) echo "h4 {font-size: ". $h4_size ."px !important;}\n";
	if ($h5_size) echo "h5 {font-size: ". $h5_size ."px !important;}\n";
	if ($h6_size) echo "h6 {font-size: ". $h6_size ."px !important;}\n";

	if ($content_fsize) echo "body {font-size: ". $content_fsize ."px !important;}\n";
	if ($content_lineheight){
		echo "#kids_middle_container {line-height: ". $content_lineheight ."px !important;}\n";
		echo "#kids_middle_container p {line-height: ". $content_lineheight ."px !important;}\n";
	}

	if (!$pretty_social) echo ".pp_social {display:none;}\n";

?>